using System;
using NHibernate;

namespace Sedna.Core.Persistence
{
	/// <summary>
	/// a variant of an IFilterState that exports its state as a 
	/// NHibernate ICriteria. So the basic job of a Filter that implements this interface
	/// is to provide a valid and correct ICriteria instance that corresponds its internal 
	/// state (i.e. the contents of a Filter properties)
	/// </summary>
	public interface ICriteriaFilterState : IFilterState
	{
		/// <summary>
		/// this method is used by a <see cref="IHqlExecutor"/> to obtain a 
		/// valid and corresponding ICriteria that represents the internal filter state
		/// 
		/// Please note that it is the responsibility of a particular Filter implementor
		/// to make the implementation of this method in such a way that an instance of
		/// a ICriteria represent an actual filter state.
		/// </summary>
		/// <param name="session">NHibernate open and valid session</param>
		/// <returns>an instance of an ICriteria that corresponds the internal filter state</returns>
		ICriteria ToHqlCriteria(ISession session);
	}
}
